<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Platform Security Architecture — cryptography and keystore interface: Key policies</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Platform Security Architecture — cryptography and keystore interface
   &#160;<span id="projectnumber">Working draft</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Key policies</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga7dddccdd1303176e87a4d20c87b589ed"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7dddccdd1303176e87a4d20c87b589ed">PSA_KEY_USAGE_EXPORT</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000001)</td></tr>
<tr class="separator:ga7dddccdd1303176e87a4d20c87b589ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga75153b296d045d529d97203a6a995dad"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga75153b296d045d529d97203a6a995dad">PSA_KEY_USAGE_ENCRYPT</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000100)</td></tr>
<tr class="separator:ga75153b296d045d529d97203a6a995dad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac3f2d2e5983db1edde9f142ca9bf8e6a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gac3f2d2e5983db1edde9f142ca9bf8e6a">PSA_KEY_USAGE_DECRYPT</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000200)</td></tr>
<tr class="separator:gac3f2d2e5983db1edde9f142ca9bf8e6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga99b9f456cf59efc4b5579465407aef5a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga99b9f456cf59efc4b5579465407aef5a">PSA_KEY_USAGE_SIGN</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000400)</td></tr>
<tr class="separator:ga99b9f456cf59efc4b5579465407aef5a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga39b54ffd5958b69634607924fa53cea6"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga39b54ffd5958b69634607924fa53cea6">PSA_KEY_USAGE_VERIFY</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000800)</td></tr>
<tr class="separator:ga39b54ffd5958b69634607924fa53cea6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf19022acc5ef23cf12477f632b48a0b2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaf19022acc5ef23cf12477f632b48a0b2">PSA_KEY_USAGE_DERIVE</a>&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00001000)</td></tr>
<tr class="separator:gaf19022acc5ef23cf12477f632b48a0b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="memItemLeft" align="right" valign="top"><a id="ga7bb9de71337e0e98de843aa7f9b55f25"></a>
typedef uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a></td></tr>
<tr class="memdesc:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encoding of permitted usage on a key. <br /></td></tr>
<tr class="separator:ga7bb9de71337e0e98de843aa7f9b55f25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf553efd409845b6d09ff25ce2ba36607"><td class="memItemLeft" align="right" valign="top">typedef struct psa_key_policy_s&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a></td></tr>
<tr class="separator:gaf553efd409845b6d09ff25ce2ba36607"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gad49eb85e3fcbe70f763f511ac83e762e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gad49eb85e3fcbe70f763f511ac83e762e">psa_key_policy_init</a> (<a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr>
<tr class="memdesc:gad49eb85e3fcbe70f763f511ac83e762e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize a key policy structure to a default that forbids all usage of the key.  <a href="#gad49eb85e3fcbe70f763f511ac83e762e">More...</a><br /></td></tr>
<tr class="separator:gad49eb85e3fcbe70f763f511ac83e762e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac16792fd6d375a5f76d372090df40607"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gac16792fd6d375a5f76d372090df40607">psa_key_policy_set_usage</a> (<a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy, <a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> usage, <a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> alg)</td></tr>
<tr class="memdesc:gac16792fd6d375a5f76d372090df40607"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the standard fields of a policy structure.  <a href="#gac16792fd6d375a5f76d372090df40607">More...</a><br /></td></tr>
<tr class="separator:gac16792fd6d375a5f76d372090df40607"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga7746662b7503e484774d0ecb5d8ac2ab">psa_key_policy_get_usage</a> (const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr>
<tr class="memdesc:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve the usage field of a policy structure.  <a href="#ga7746662b7503e484774d0ecb5d8ac2ab">More...</a><br /></td></tr>
<tr class="separator:ga7746662b7503e484774d0ecb5d8ac2ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gaadf16b89ace53e1d2cb5bcb0aef24c86">psa_key_policy_get_algorithm</a> (const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr>
<tr class="memdesc:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve the algorithm field of a policy structure.  <a href="#gaadf16b89ace53e1d2cb5bcb0aef24c86">More...</a><br /></td></tr>
<tr class="separator:gaadf16b89ace53e1d2cb5bcb0aef24c86"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad7faa7e64aa771f7441c44ceff21af19"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#gad7faa7e64aa771f7441c44ceff21af19">psa_set_key_policy</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr>
<tr class="memdesc:gad7faa7e64aa771f7441c44ceff21af19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the usage policy on a key slot.  <a href="#gad7faa7e64aa771f7441c44ceff21af19">More...</a><br /></td></tr>
<tr class="separator:gad7faa7e64aa771f7441c44ceff21af19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga613f28712124f9149bd640614376ab5a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__policy.html#ga613f28712124f9149bd640614376ab5a">psa_get_key_policy</a> (<a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a> key, <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *policy)</td></tr>
<tr class="memdesc:ga613f28712124f9149bd640614376ab5a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the usage policy for a key slot.  <a href="#ga613f28712124f9149bd640614376ab5a">More...</a><br /></td></tr>
<tr class="separator:ga613f28712124f9149bd640614376ab5a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="gac3f2d2e5983db1edde9f142ca9bf8e6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac3f2d2e5983db1edde9f142ca9bf8e6a">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_DECRYPT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_DECRYPT&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000200)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be used to decrypt a message.</p>
<p>This flag allows the key to be used for a symmetric decryption operation, for an AEAD decryption-and-verification operation, or for an asymmetric decryption operation, if otherwise permitted by the key's type and policy.</p>
<p>For a key pair, this concerns the private key. </p>

</div>
</div>
<a id="gaf19022acc5ef23cf12477f632b48a0b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf19022acc5ef23cf12477f632b48a0b2">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_DERIVE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_DERIVE&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00001000)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be used to derive other keys. </p>

</div>
</div>
<a id="ga75153b296d045d529d97203a6a995dad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga75153b296d045d529d97203a6a995dad">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_ENCRYPT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_ENCRYPT&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000100)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be used to encrypt a message.</p>
<p>This flag allows the key to be used for a symmetric encryption operation, for an AEAD encryption-and-authentication operation, or for an asymmetric encryption operation, if otherwise permitted by the key's type and policy.</p>
<p>For a key pair, this concerns the public key. </p>

</div>
</div>
<a id="ga7dddccdd1303176e87a4d20c87b589ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7dddccdd1303176e87a4d20c87b589ed">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_EXPORT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_EXPORT&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000001)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be exported.</p>
<p>A public key or the public part of a key pair may always be exported regardless of the value of this permission flag.</p>
<p>If a key does not have export permission, implementations shall not allow the key to be exported in plain form from the cryptoprocessor, whether through <a class="el" href="group__key__management.html#gaa67bc459b20028b268f3d75a05afe022" title="Export a key in binary format. ">psa_export_key()</a> or through a proprietary interface. The key may however be exportable in a wrapped form, i.e. in a form where it is encrypted by another key. </p>

</div>
</div>
<a id="ga99b9f456cf59efc4b5579465407aef5a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga99b9f456cf59efc4b5579465407aef5a">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_SIGN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_SIGN&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000400)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be used to sign a message.</p>
<p>This flag allows the key to be used for a MAC calculation operation or for an asymmetric signature operation, if otherwise permitted by the key's type and policy.</p>
<p>For a key pair, this concerns the private key. </p>

</div>
</div>
<a id="ga39b54ffd5958b69634607924fa53cea6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga39b54ffd5958b69634607924fa53cea6">&#9670;&nbsp;</a></span>PSA_KEY_USAGE_VERIFY</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PSA_KEY_USAGE_VERIFY&#160;&#160;&#160;((<a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>)0x00000800)</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Whether the key may be used to verify a message signature.</p>
<p>This flag allows the key to be used for a MAC verification operation or for an asymmetric signature verification operation, if otherwise permitted by by the key's type and policy.</p>
<p>For a key pair, this concerns the public key. </p>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="gaf553efd409845b6d09ff25ce2ba36607"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf553efd409845b6d09ff25ce2ba36607">&#9670;&nbsp;</a></span>psa_key_policy_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct psa_key_policy_s <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The type of the key policy data structure.</p>
<p>This is an implementation-defined <code>struct</code>. Applications should not make any assumptions about the content of this structure except as directed by the documentation of a specific implementation. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga613f28712124f9149bd640614376ab5a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga613f28712124f9149bd640614376ab5a">&#9670;&nbsp;</a></span>psa_get_key_policy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_get_key_policy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the usage policy for a key slot. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>The key slot whose policy is being queried. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">policy</td><td>On success, the key's policy.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaadf16b89ace53e1d2cb5bcb0aef24c86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaadf16b89ace53e1d2cb5bcb0aef24c86">&#9670;&nbsp;</a></span>psa_key_policy_get_algorithm()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a> psa_key_policy_get_algorithm </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve the algorithm field of a policy structure. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The permitted algorithm for a key with this policy. </dd></dl>

</div>
</div>
<a id="ga7746662b7503e484774d0ecb5d8ac2ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7746662b7503e484774d0ecb5d8ac2ab">&#9670;&nbsp;</a></span>psa_key_policy_get_usage()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a> psa_key_policy_get_usage </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve the usage field of a policy structure. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The permitted uses for a key with this policy. </dd></dl>

</div>
</div>
<a id="gad49eb85e3fcbe70f763f511ac83e762e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad49eb85e3fcbe70f763f511ac83e762e">&#9670;&nbsp;</a></span>psa_key_policy_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void psa_key_policy_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize a key policy structure to a default that forbids all usage of the key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">policy</td><td>The policy object to initialize. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gac16792fd6d375a5f76d372090df40607"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac16792fd6d375a5f76d372090df40607">&#9670;&nbsp;</a></span>psa_key_policy_set_usage()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void psa_key_policy_set_usage </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__policy.html#ga7bb9de71337e0e98de843aa7f9b55f25">psa_key_usage_t</a>&#160;</td>
          <td class="paramname"><em>usage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__crypto__types.html#gac2e4d47f1300d73c2f829a6d99252d69">psa_algorithm_t</a>&#160;</td>
          <td class="paramname"><em>alg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the standard fields of a policy structure. </p>
<p>Note that this function does not make any consistency check of the parameters. The values are only checked when applying the policy to a key slot with <a class="el" href="group__policy.html#gad7faa7e64aa771f7441c44ceff21af19" title="Set the usage policy on a key slot. ">psa_set_key_policy()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">policy</td><td>The policy object to modify. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">usage</td><td>The permitted uses for the key. </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">alg</td><td>The algorithm that the key may be used for. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gad7faa7e64aa771f7441c44ceff21af19"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad7faa7e64aa771f7441c44ceff21af19">&#9670;&nbsp;</a></span>psa_set_key_policy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__basic.html#ga05676e70ba5c6a7565aff3c36677c1f9">psa_status_t</a> psa_set_key_policy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__platform.html#gac3da92a6b8a7f0c01dc348f8e0432e4c">psa_key_slot_t</a>&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__policy.html#gaf553efd409845b6d09ff25ce2ba36607">psa_key_policy_t</a> *&#160;</td>
          <td class="paramname"><em>policy</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the usage policy on a key slot. </p>
<p>This function must be called on an empty key slot, before importing, generating or creating a key in the slot. Changing the policy of an existing key is not permitted.</p>
<p>Implementations may set restrictions on supported key policies depending on the key type and the key slot.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">key</td><td>The key slot whose policy is to be changed. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">policy</td><td>The policy object to query.</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga4cc859e2c66ca381c7418db3527a65e1">PSA_SUCCESS</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#gac2fee3a51249fbea45360aaa911f3e58">PSA_ERROR_OCCUPIED_SLOT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga1dcc6d130633ed5db8942257581b55dd">PSA_ERROR_NOT_SUPPORTED</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga798df25a505ebf931f7bec1f80f1f85f">PSA_ERROR_INVALID_ARGUMENT</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga5cdb6948371d49e916106249020ea3f7">PSA_ERROR_COMMUNICATION_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga08b10e70fa5ff0b05c631d9f8f6b2c6b">PSA_ERROR_HARDWARE_FAILURE</a></td><td></td></tr>
    <tr><td class="paramname"><a class="el" href="group__basic.html#ga2c5dda1485cb54f2385cb9c1279a7004">PSA_ERROR_TAMPERING_DETECTED</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
